/*
 * <h3>Title:wheel-spring-boot-web-starter系统</h3>
 * <p>Copyright (c) 2019, wnfbx@163.com. All rights reserved.</p>
 * @author wnfbx@163.com
 */
package com.wheel.core.exception;

import java.io.Serializable;

/**
 * <dt>Description:ResultMessageCode</dt>
 * <dd>返回消息代码对象定义</dd>
 *
 * @author wnfbx@163.com
 * @version 1.0 <i>2019年6月6日 下午7:34:57</i>
 * @since jdk1.7+
 */
public class ResultCode implements Comparable<ResultCode>, Serializable {

    private static final long serialVersionUID = 1177318984197913276L;

    public static final String CODE_EXCEPTION_REPO_INSERT = "exception_repo_insert";

    public static final String CODE_EXCEPTION_REPO_UPDATE = "exception_repo_update";

    public static final String CODE_EXCEPTION_REPO_DELETE = "exception_repo_delete";

    public static final String CODE_EXCEPTION_REPO_SELECT = "exception_repo_select";

    public static final String CODE_EXCEPTION_REST_PUT = "exception_rest_put";

    public static final String CODE_EXCEPTION_REST_POST = "exception_rest_post";

    public static final String CODE_EXCEPTION_REST_DELETE = "exception_rest_delete";

    public static final String CODE_EXCEPTION_REST_GET = "exception_rest_get";

    public static final String CODE_EXCEPTION_REST_HEAD = "exception_rest_head";

    public static final String CODE_EXCEPTION_REST_PATCH = "exception_rest_patch";

    public static final String CODE_EXCEPTION_REST_OPTIONS = "exception_rest_options";

    public static final String CODE_EXCEPTION_REST_EXCHANGE = "exception_rest_exchange";

    public static final String CODE_EXCEPTION_ILLEGAL_ARGUMENT = "exception_illegal_argument";

    public static final String CODE_EXCEPTION_ARGUMENT_NOT_VALID ="exception_argument_not_valid";

    public static final String CODE_EXCEPTION_RUNTIME = "exception_runtime";

    public static final String CODE_EXCEPTION_NO_HANDLER_FOUND = "exception_no_handler_found";


    // 返回值定义
    public static final ResultCode EXCEPTION_INSERT = new ResultCode(CODE_EXCEPTION_REPO_INSERT);

    public static final ResultCode EXCEPTION_UPDATE = new ResultCode(CODE_EXCEPTION_REPO_UPDATE);

    public static final ResultCode EXCEPTION_DELETE = new ResultCode(CODE_EXCEPTION_REPO_DELETE);

    public static final ResultCode EXCEPTION_SELECT = new ResultCode(CODE_EXCEPTION_REPO_SELECT);

    public static final ResultCode EXCEPTION_REST_PUT = new ResultCode(CODE_EXCEPTION_REST_PUT);

    public static final ResultCode EXCEPTION_REST_POST = new ResultCode(CODE_EXCEPTION_REST_POST);

    public static final ResultCode EXCEPTION_REST_DELETE = new ResultCode(CODE_EXCEPTION_REST_DELETE);

    public static final ResultCode EXCEPTION_REST_GET = new ResultCode(CODE_EXCEPTION_REST_GET);

    public static final ResultCode EXCEPTION_REST_HEAD = new ResultCode(CODE_EXCEPTION_REST_HEAD);

    public static final ResultCode EXCEPTION_REST_PATCH = new ResultCode(CODE_EXCEPTION_REST_PATCH);

    public static final ResultCode EXCEPTION_REST_OPTIONS = new ResultCode(CODE_EXCEPTION_REST_OPTIONS);

    public static final ResultCode EXCEPTION_REST_EXCHANGE = new ResultCode(CODE_EXCEPTION_REST_EXCHANGE);

    public static final ResultCode EXCEPTION_ILLEGAL_ARGUMENT = new ResultCode(CODE_EXCEPTION_ILLEGAL_ARGUMENT);

    public static final ResultCode EXCEPTION_ARGUMENT_NOT_VALID = new ResultCode(CODE_EXCEPTION_ARGUMENT_NOT_VALID);

    public static final ResultCode EXCEPTION_RUNTIME = new ResultCode(CODE_EXCEPTION_RUNTIME);

    public static final ResultCode EXCEPTION_NO_HANDLER_FOUND = new ResultCode(CODE_EXCEPTION_NO_HANDLER_FOUND);


    private String code;

    public ResultCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    @Override
    public int compareTo(ResultCode o) {
        return this.code.compareTo(o.getCode());
    }
}
